home *** CD-ROM | disk | FTP | other *** search
/ Aminet 22 / Aminet 22 (1997)(GTI - Schatztruhe)[!][Dec 1997].iso / Aminet / util / cdity / VesaDPMSPro.lha / VesaDPMSPro / custom.asm next >
Assembly Source File  |  1997-09-11  |  2KB  |  82 lines

  1.         ; Handoptimized Custom CxObj routine, fast and efficient
  2.         ; Total rewrite of C-Compiler output (which was partial crap)
  3.         ;
  4.         ; This function supports pipelining of the latest MC680x0 processors,
  5.         ; when possible (that means mixing opcodes, that use different
  6.         ; functional units of the processor, to parallelize some processes).
  7.         ; That's also known as "scaling".
  8.         ;
  9.         ; According to the RKM, this function also makes no assumptions about
  10.         ; registers, and restores all registers used by itself to the values
  11.         ; they contained at entry. However, this uses up 20 bytes of stack.
  12.         ;
  13.         ; Only two system functions are called: CxMsgData() and Signal()
  14.         
  15.         XREF    _SysBase
  16.         XREF    _CxBase
  17.         XREF    _listen
  18.         XREF    _lastsig
  19.         XREF    _prefs
  20.         
  21.         XDEF    _cx_custom_func
  22.         
  23. _cx_custom_func
  24.         movem.l    d0/d1/a0/a1/a6,-(sp)
  25.         
  26.         move.l    24(sp),a0            ;get cxm
  27.         move.l    _CxBase,a6
  28.         jsr        -$90(a6)                ;CxMsgData(cxm)
  29.         move.l    d0,a0                    ;InputEvent
  30.         
  31.         moveq.l    #1,d1                    ;1
  32.         sub.l        d0,d0                    ;erase register (faster on '060)
  33.         move.b    4(a0),d0                ;InputEvent->ie_Class
  34.         asl.l        d0,d1                    ;<<
  35.         and.l        _listen,d1            ;(1 << InputEvent->ie_Class) & listen
  36.         beq.b        ciao                    ;if not, quit
  37.         
  38.         move.l    _lastsig,d1            ;lastsig
  39.         move.l    14(a0),d0            ;InputEvent->ie_TimeStamp.tv_secs
  40.         cmp.l        d0,d1                    ;lastsig - InputEvent->ie_TimeStamp.tv_secs
  41.         bhi.b        higher                ;if higher
  42.         
  43.         sub.l        d1,d0                    ;else equal/lower, calculate difference
  44.         bra.b        delta                    ;skip higher
  45.         
  46. higher
  47.         sub.l        d0,d1                    ;calculate difference
  48.         move.l    d1,d0                    ;use appropriate register
  49.         
  50. delta
  51.         cmp.l        #1,d0                    ;delta - 4
  52.         bls.b        ciao                    ;if lower or same, quit
  53.         
  54.         tst.l        _prefs+28            ;prefs.dpmslevel
  55.         beq.b        signal                ;if null (== DPMS_ON), signal every event
  56.         
  57.         moveq.l    #1,d1                    ;else 1
  58.         sub.l        d0,d0                    ;erase register
  59.         move.b    4(a0),d0                ;InputEvent->ie_Class
  60.         asl.l        d0,d1                    ;<<
  61.         and.l        _prefs+24,d1        ;(1 << InputEvent->ie_Class) & prefs.wakeup
  62.         beq.b        ciao                    ;if no wakeup event, quit
  63.         
  64. signal
  65.         move.l    14(a0),_lastsig    ;lastsig = InputEvent->ie_TimeStamp.tv_secs
  66.         
  67.         moveq.l    #1,d0                    ;1
  68.         move.l    _prefs+32,d1        ;prefs.signal
  69.         asl.l        d1,d0                    ;<<
  70.         
  71.         move.l    _prefs+4,a1            ;prefs->cxport
  72.         move.l    16(a1),a1            ;MsgPort->mp_SigTask
  73.         move.l    _SysBase,a6
  74.         jsr        -$144(a6)            ;Signal(prefs.cxport->mp_SigTask, 1 << prefs.signal)
  75.         
  76. ciao
  77.         movem.l    (sp)+,d0/d1/a0/a1/a6
  78.         rts
  79.         
  80.         END
  81.  
  82.